<!--#include file="../../../../easyasp/easp.asp" -->
<%
Easp.NoCache
%>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title></title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
</head>
<body>
  <div class="layui-fluid">
    <div class="layui-card">
      <div class="layui-form layui-card-header layuiadmin-card-header-auto">
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">检索</label>
            <div class="layui-input-block">
              <input type="text" name="username" placeholder="请输入" autocomplete="off" class="layui-input">
            </div>
          </div>

          <div class="layui-inline">
            <button class="layui-btn layuiadmin-btn-useradmin" lay-submit lay-filter="user-front-search">
              <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
            </button>
			<!--
			<button class="layui-btn getCheckData" data-type="getCheckData">删除选中行</button>			
			<button class="layui-btn batchQrjf" data-type="batchQrjf">批量确认积分</button>			
			-->
          </div>
        </div>
      </div>
      
      <div class="layui-card-body">
		<script type="text/html" id="barDemo">
			<!--<a class="layui-btn layui-btn-xs" lay-event="edit">确认该积分</a>-->
			<!--<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>-->
		</script>
        <table id="user-manage" lay-filter="user-manage"></table>
      </div>
    </div>
  </div>

  <script src="../../../layuiadmin/layui/layui.js"></script>  
  <script>
  layui.config({
    base: '../../../layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'useradmin', 'table'], function(){
    var $ = layui.$
    ,form = layui.form
    ,table = layui.table;
	
    var $ = layui.$,
    active = {
        reload: function() {
            var demoReload = $('#user-manage');
            table.reload('testReload', {
                where: {
                    key: {
                        id: demoReload.val()
                    }
                }
            });
        },
	  batchQrjf: function(){
        var checkStatus = table.checkStatus('user-manage')
        ,data = checkStatus.data;
		
		layer.confirm('您确定确认选中行？' , {
				icon: 3,
				title: '提示信息'
			},				function(index) {	
		$.ajax({
		  type: "post",
		  url: layui.setter.base + 'lib/reg.asp?action=batchQrjf',
		  data:JSON.stringify(data),
		  dataType: 'json',
		  success: function (data) {
		  }
		});
				layer.close(index);
				table.reload('user-manage');		
		});
      },
      getCheckData: function(){
        var checkStatus = table.checkStatus('user-manage')
        ,data = checkStatus.data;
		
			layer.confirm('您确定删除选中行？' , {
				icon: 3,
				title: '提示信息'
			},				function(index) {	
		$.ajax({
		  type: "post",
		  url: layui.setter.base + 'lib/reg.asp?action=getCheckData',
		  data:JSON.stringify(data),
		  dataType: 'json',
		  success: function (data) {
		  }
		});
				layer.close(index);
				table.reload('user-manage');		
}		);
      }	
    };		
	
	table.render({
        elem: '#user-manage',
        url: layui.setter.base + 'lib/reg.asp?action=listjf',
        cols: [[{
            checkbox: true,
            fixed: true
        },
        {
            field: 'ID',
            title: 'ID',
            width: 40,
            sort: true,
            fixed: false
        },
        {
            field: 'jsr',
            title: '用户名',
            width: 80
        },		
        {
            field: 'username',
            title: '积分来源',
            width: 120
        },
        {
            field: 'type',
            title: '积分类型',
            width: 120
        },	
        {
            field: 'qrjf',
            title: '是否审核',
            width: 120
        },	
	
        {
            field: 'jf',
            title: '积分',
            width: 120
        },
        {
            field: 'things',
            title: '事情',
            width: 250
        },			
        {
            field: 'ins_time',
            title: '时间',
            width: 120
        },			
        {
            fixed: 'right',
            width: 160,
            align: 'center',
            toolbar: '#barDemo'
        }]],
        id: 'user-manage',
        limit: 10,
        page: true,
        height: 475
    });
	
    form.on('submit(user-front-search)', function(data){
      var field = data.field;
      
      table.reload('user-manage', {
        where: field
      });
            layer.msg('已重载');	  
    });
	
    table.on('tool(user-manage)',
    function(obj) {
        var data = obj.data;
        if (obj.event === 'edit') {
			layer.confirm('您确定审核通过此信息？' + data.ID, {
				icon: 3,
				title: '提示信息'
			},
			function(index) {
				$.post(layui.setter.base + 'lib/reg.asp?now=' + new Date().getTime(), {
					id: data.ID,
					jsr:data.jsr,
					action: "jfCheck"
				},
				function(data) {
					if (data == '1') {
						layer.msg("成功!!");
					} else {
						layer.msg("失败！！ "+data);
					}
				});
				layer.close(index);
				table.reload('user-manage');				
			});			
			
			
        }
		else if (obj.event === 'del') {
			var _this = $(this);
			layer.confirm('您确定删除此信息？' + data.ID, {
				icon: 3,
				title: '提示信息'
			},
			function(index) {
				$.post(layui.setter.base + 'lib/reg.asp?now=' + new Date().getTime(), {
					id: data.ID,
					jsr:data.jsr,
					action: "jfDel"
				},
				function(data) {
					if (data == '1') {
						layer.msg("成功!!");
					} else {
						layer.msg("失败！！ "+data);
					}
				});
				layer.close(index);
				table.reload('user-manage');				
			});
		}	
	
	});	
    
    $('.layui-btn').on('click', function(){
      var type = $(this).data('type');
      active[type] ? active[type].call(this) : '';
    });
	
  });
  </script>
</body>
</html>
